package com.example.demo1.service;

import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author zx
 * @Date 2022/2/10 11:03
 * @Version 1.0
 */
@Component
public class UserService {

    private OrderService orderService;


//    UserService(){
//
//    }

    @Autowired //ioc是默认使用无参构造器装配，当有两个有参构造器而没有无参构造器时，需要在构造器上添加@Autowired注解来指定哪个构造器
    public UserService(OrderService orderService1) {
        this.orderService = orderService1;
        System.out.println("111");
    }



    public UserService(OrderService orderService,OrderService orderService1) {
        this.orderService = orderService;
        System.out.println("222");
    }

}
